package 如何初始化数组;

public class 数组反转8 {
	
	 public static void main(String[] args)
	    {
	        int[] a = new int[5];
	        for(int i=0;i<a.length;i++) {
	            a[i] = (int)(Math.random()*100);
	        }
	         
	        System.out.println("the numbers in this array are: ");
	        for (int i = 0; i < a.length; i++)
	            System.out.println(a[i]);
	         
	        int temp;
	        for(int j=0;j<a.length/2;j++){
	            temp = a[j];//after storing this number, we can change it.
	            a[j] = a[a.length-1-j];
	            a[a.length-1-j]=temp;
	        }
	        System.out.println("the numbers in this array after reversed are: ");
	        for (int i = 0; i < a.length; i++)
	            System.out.println(a[i]);
	    }
}
